/**
 * @author: Miss.杨
 * @date: 2024年12月29日 22:05:38
 * @description: 
 */
package com.sheepone.monitor.server;

import com.sheepone.monitor.core.AbstractSheeponeChannelInitializer;
import com.sheepone.monitor.server.handler.ServerExceptionHandler;
import com.sheepone.monitor.server.handler.connect.ConnectionManager;
import com.sheepone.monitor.server.handler.connect.ServerHeartbeatHandler;

/**
 * @author: Miss.杨
 * @date: 2024年12月29日 22:05:38
 * @description: 与服务端建立连接的SocketChannel的ChannelInitializer，用于服务端与客户端通信的数据处理
 */
public abstract class BaseMonitorSeverChannelInitializer extends AbstractSheeponeChannelInitializer {
    private final static ServerExceptionHandler SERVER_EXCEPTION_HANDLER = new ServerExceptionHandler();
    private final static ServerHeartbeatHandler SERVER_HEARTBEAT_HANDLER = new ServerHeartbeatHandler();
    private final static ConnectionManager CONNECTION_MANAGER = new ConnectionManager();

    public BaseMonitorSeverChannelInitializer() {
        // 客户端连接管理器
        addHandler(CONNECTION_MANAGER);
        // 心跳处理器
        addHandler(SERVER_HEARTBEAT_HANDLER);
        // 异常处理器
        addHandler(SERVER_EXCEPTION_HANDLER);
        // 空闲事件触发器
        // addHandler(new MonitorIdleStateHandler(2, 0, 0, TimeUnit.MINUTES));
    }

}
